// const API_BASE_URL = 'http://000.000.0.00:8080/';
const request = (method, url, data) => {
  let _url = API_BASE_URL + url;
  return new Promise((resolve, reject) => {
    wx.request({
      url: _url,
      method: method,
      data: data,
      success(request) {
        resolve(request.data)
      },
      fail(error) {
        reject(error)
      }
    })
  });
}
module.exports = {
  //订单列表
  getOrderList: (data) => {
    return request('get', 'wechat/order/list', data)
  },
  //订单详情
  getOrderDetail: (data) => {
    return request('get', 'wechat/order/detail', data)
  },
  //确认收货
  orderConfirmation: (data) => {
    return request('get', 'wechat/order/confirmation', data)
  },
  //我的分享
  myShare: (data) => {
    return request('get', 'myshare/order/my', data)
  },
  //分享订单
  getMyShareOrderList: (data) => {
    return request('get', 'myshare/order/list', data)
  },
  //分享用户
  getMyShareUserList: (data) => {
    return request('get', 'myshare/order/user', data)
  },
  //余额明细
  getBalanceRecordList: (data) => {
    return request('get', 'wechat/wallet/balanceRecordlist', data)
  },
  //提现列表
  getWithdrawList: (data) => {
    return request('get', 'wechat/wallet/withdrawlist', data)
  },
  //提现详情
  getWithdrawInfo: (data) => {
    return request('get', 'wechat/wallet/withdrawone', data)
  },
  //地址列表
  getAddressList: (data) => {
    return request('get', 'wechat/address/list', data)
  },
  //删除地址
  deleteAddress: (data) => {
    return request('get', 'wechat/address/delete', data)
  },
  //获取微信token
  getWXtoken: (data) => {
    return request('get', 'wechat/wx_token', data)
  },
  //微信授权
  checkOpenid: (data) => {
    return request('get', 'wechat/checkOpenId', data)
  },
  //用户信息
  getMyUserInfo: (data) => {
    return request('get', 'wechat/user/userInfo', data)
  },
  //添加地址
  addAddress: (data) => {
    return request('get', 'wechat/address/add', data)
  },
  //设置修改安全码
  securityCode: (data) => {
    return request('post', 'wechat/user/securityCode', data)
  },
  //实名信息登记
  addRealNameInfo: (data) => {
    return request('get', 'wechat/user/addName', data)
  },
  //地址详情
  getAddressInfo: (data) => {
    return request('get', 'wechat/address/info', data)
  },
  //商品详情
  getGoodsDetails: (data) => {
    return request('get', 'wechat/goods', data)
  },
  //支付
  pay: (data) => {
    return request('get', 'wechat/order/buy', data)
  },
  //统一下单
  order: (data) => {
    return request('get', 'wechat/unifiedOrder', data)
  },
  //绑定手机
  bindMobile: (data) => {
    return request('get', 'wechat/BindMobile', data)
  },
  //设置安全码
  setSecurityCode: (data) => {
    return request('get', 'wechat/user/securityCode', data)
  },
  //修改设置支付宝
  settingAPlay: (data) => {
    return request('get', 'wechat/wallet/addPayNum', data)
  },
  //最低提现额度
  lastMoney: (data) => {
    return request('get', 'wechat/wallet/lines', data)
  },
  //提现
  getMoeny: (data) => {
    return request('get', 'wechat/wallet/tx', data)
  },
}
